//https://leetcode.cn/problems/is-unique-lcci/submissions/560388440/
class Solution {
    public boolean isUnique(String astr) {
        //鸽巢原理
        if(astr.length() > 26) return false;
        //哈希表
        int[] hash = new int[26];
        for(int i = 0; i < astr.length(); i++) {
            int index = astr.charAt(i) - 'a';
            if(hash[index] == 0) hash[index]++;
            else return false;
        }
        return true;
    }
}